package qldc.pm.tiensu.model.impl;

import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;

import qldc.pm.tiensu.model.BienBanBanGiaoHoSo;

import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;

import java.util.Date;

/**
 * The cache model class for representing BienBanBanGiaoHoSo in entity cache.
 *
 * @author Brian Wing Shun Chan
 * @see BienBanBanGiaoHoSo
 * @generated
 */
public class BienBanBanGiaoHoSoCacheModel implements CacheModel<BienBanBanGiaoHoSo>,
    Externalizable {
    public long bienBanBanGiaoHoSoId;
    public String kinhGui;
    public String nguoiLap;
    public String nguoiDuocBanGiao;
    public String chucVu;
    public String chucVuNguoiDuocBanGiao;
    public String noiDung;
    public long ngayLap;
    public long ngayBanGiao;
    public String diaDiemBanGiao;

    @Override
    public String toString() {
        StringBundler sb = new StringBundler(21);

        sb.append("{bienBanBanGiaoHoSoId=");
        sb.append(bienBanBanGiaoHoSoId);
        sb.append(", kinhGui=");
        sb.append(kinhGui);
        sb.append(", nguoiLap=");
        sb.append(nguoiLap);
        sb.append(", nguoiDuocBanGiao=");
        sb.append(nguoiDuocBanGiao);
        sb.append(", chucVu=");
        sb.append(chucVu);
        sb.append(", chucVuNguoiDuocBanGiao=");
        sb.append(chucVuNguoiDuocBanGiao);
        sb.append(", noiDung=");
        sb.append(noiDung);
        sb.append(", ngayLap=");
        sb.append(ngayLap);
        sb.append(", ngayBanGiao=");
        sb.append(ngayBanGiao);
        sb.append(", diaDiemBanGiao=");
        sb.append(diaDiemBanGiao);
        sb.append("}");

        return sb.toString();
    }

    @Override
    public BienBanBanGiaoHoSo toEntityModel() {
        BienBanBanGiaoHoSoImpl bienBanBanGiaoHoSoImpl = new BienBanBanGiaoHoSoImpl();

        bienBanBanGiaoHoSoImpl.setBienBanBanGiaoHoSoId(bienBanBanGiaoHoSoId);

        if (kinhGui == null) {
            bienBanBanGiaoHoSoImpl.setKinhGui(StringPool.BLANK);
        } else {
            bienBanBanGiaoHoSoImpl.setKinhGui(kinhGui);
        }

        if (nguoiLap == null) {
            bienBanBanGiaoHoSoImpl.setNguoiLap(StringPool.BLANK);
        } else {
            bienBanBanGiaoHoSoImpl.setNguoiLap(nguoiLap);
        }

        if (nguoiDuocBanGiao == null) {
            bienBanBanGiaoHoSoImpl.setNguoiDuocBanGiao(StringPool.BLANK);
        } else {
            bienBanBanGiaoHoSoImpl.setNguoiDuocBanGiao(nguoiDuocBanGiao);
        }

        if (chucVu == null) {
            bienBanBanGiaoHoSoImpl.setChucVu(StringPool.BLANK);
        } else {
            bienBanBanGiaoHoSoImpl.setChucVu(chucVu);
        }

        if (chucVuNguoiDuocBanGiao == null) {
            bienBanBanGiaoHoSoImpl.setChucVuNguoiDuocBanGiao(StringPool.BLANK);
        } else {
            bienBanBanGiaoHoSoImpl.setChucVuNguoiDuocBanGiao(chucVuNguoiDuocBanGiao);
        }

        if (noiDung == null) {
            bienBanBanGiaoHoSoImpl.setNoiDung(StringPool.BLANK);
        } else {
            bienBanBanGiaoHoSoImpl.setNoiDung(noiDung);
        }

        if (ngayLap == Long.MIN_VALUE) {
            bienBanBanGiaoHoSoImpl.setNgayLap(null);
        } else {
            bienBanBanGiaoHoSoImpl.setNgayLap(new Date(ngayLap));
        }

        if (ngayBanGiao == Long.MIN_VALUE) {
            bienBanBanGiaoHoSoImpl.setNgayBanGiao(null);
        } else {
            bienBanBanGiaoHoSoImpl.setNgayBanGiao(new Date(ngayBanGiao));
        }

        if (diaDiemBanGiao == null) {
            bienBanBanGiaoHoSoImpl.setDiaDiemBanGiao(StringPool.BLANK);
        } else {
            bienBanBanGiaoHoSoImpl.setDiaDiemBanGiao(diaDiemBanGiao);
        }

        bienBanBanGiaoHoSoImpl.resetOriginalValues();

        return bienBanBanGiaoHoSoImpl;
    }

    @Override
    public void readExternal(ObjectInput objectInput) throws IOException {
        bienBanBanGiaoHoSoId = objectInput.readLong();
        kinhGui = objectInput.readUTF();
        nguoiLap = objectInput.readUTF();
        nguoiDuocBanGiao = objectInput.readUTF();
        chucVu = objectInput.readUTF();
        chucVuNguoiDuocBanGiao = objectInput.readUTF();
        noiDung = objectInput.readUTF();
        ngayLap = objectInput.readLong();
        ngayBanGiao = objectInput.readLong();
        diaDiemBanGiao = objectInput.readUTF();
    }

    @Override
    public void writeExternal(ObjectOutput objectOutput)
        throws IOException {
        objectOutput.writeLong(bienBanBanGiaoHoSoId);

        if (kinhGui == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(kinhGui);
        }

        if (nguoiLap == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(nguoiLap);
        }

        if (nguoiDuocBanGiao == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(nguoiDuocBanGiao);
        }

        if (chucVu == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(chucVu);
        }

        if (chucVuNguoiDuocBanGiao == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(chucVuNguoiDuocBanGiao);
        }

        if (noiDung == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(noiDung);
        }

        objectOutput.writeLong(ngayLap);
        objectOutput.writeLong(ngayBanGiao);

        if (diaDiemBanGiao == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(diaDiemBanGiao);
        }
    }
}
